home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / PRUS101.ZIP / FSWAP.PAS < prev    next >
Pascal/Delphi Source File  |  1995-01-16  |  3KB  |  100 lines

  1. Unit FSwap; { FIDO unit for handling swap out and execute }
  2.  (***************************************************************************
  3.  
  4.             RELEASE 1.01 - as contained in the file PRUS101.LZH
  5.                 by Peter Holschbach, 2:2450/660.3, GERMANY
  6.  
  7.                --------------------------------------------
  8.                 organized for Fido's PASCAL related echoes
  9.                --------------------------------------------
  10.  
  11.      08/28/1994 to --/--/---- by Peter Holschbach, 2:2450/660.3,  GERMANY
  12.  
  13.  
  14.            As far as third party copyrights are not violated this
  15.            source code is hereby placed to the public domain. Use
  16.            it whatever way you want, but use AT YOUR OWN RISK.
  17.  
  18.            In case you should modify the source rather send your
  19.            modifications to the unit's current organizer (see above for
  20.            NM address) than to spread it on your own. This will help to
  21.            keep the unit updated and grant a certain standard to all
  22.            other users as well.
  23.  
  24.            The unit is currently still under work. So it might greatly
  25.            benefit of your participation.
  26.  
  27.            Those who contributed to the following piece of source,
  28.            listed in alphabethical order:
  29.         ================================================================
  30.            Peter Holschbach ...
  31.         ================================================================
  32.            YOUR NAME WILL APPEAR HERE IF YOU CONTRIBUTE USEFUL SOURCE.
  33.  
  34.            Credits in your own programs are as welcome as unnecessary.
  35.  
  36.  ***************************************************************************)
  37.  
  38. {$I FDEFINE.DEF}
  39.  
  40.  
  41. Interface
  42.  
  43. Type    TSwapMem = (XMS,EMS,DISK,None);
  44.         TSwapMemSelect = Array [1..3] of TSwapMem;
  45.  
  46. Const  CSwapToAll  :  TSwapMemSelect = (EMS,XMS,DISK);
  47.        CSwapToEMS  :  TSwapMemSelect = (EMS,None,None);
  48.        CSwapToDISK :  TSwapMemSelect = (DISK,None,None);
  49.        CSwapToXMS  :  TSwapMemSelect = (XMS,None,None);
  50.  
  51.  
  52.  
  53. Var
  54.         DosRetValue  : Word;
  55.         SwapError    : Word;
  56.         SwapFilePath : String;
  57.  
  58.  
  59.  
  60.  
  61. Function ExecSwap (LastAdr : Pointer; WhereToSwap : TSwapMemSelect;ProgName,Parameters : String): Boolean;
  62.  
  63. Implementation
  64.  
  65. {----------------------------------------------------------------------------}
  66.  
  67. {$L fswap.obj}
  68.  
  69. Function SwapExec (FileName,Parameters : String; LastAdr : Pointer; Methode : TSwapMem): Word; far; external;
  70.  
  71. Function ExecSwap (LastAdr : Pointer; WhereToSwap : TSwapMemSelect;ProgName,Parameters : String): Boolean;
  72.  
  73. Var L       : Byte;
  74.  
  75. Begin
  76.   L := 0;
  77.   If (Length (ProgName) > 79) then Progname [0] := Chr (79);
  78.   If (Length (Parameters) > 126) then Parameters [0] := Chr (126);
  79.   DosRetValue := $FFFF;
  80.   Repeat
  81.     INC (L);
  82.     Case WhereToSwap [L] of
  83.       EMS  : Begin
  84.                SwapError := SwapExec (ProgName,Parameters,LastAdr,EMS);
  85.              End;
  86.       XMS  : Begin
  87.                SwapError := SwapExec (ProgName,Parameters,LastAdr,XMS);
  88.              End;
  89.       DISK : Begin
  90.                SwapError := SwapExec (ProgName,Parameters,LastAdr,DISK);
  91.              End;
  92.     End;
  93.   Until (SwapError = 0) or (L = 3);
  94.   ExecSwap := (SwapError = 0);
  95. End;
  96.  
  97.  
  98. Begin
  99.   SwapFilePath := '';
  100. End.